package com.xpalive.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class XDateUtils {

    public static final String DATE_TIME = "yyyy-MM-dd HH:mm:ss";
    public static final String DATE = "yyyy-MM-dd";
    public static final String TIME = "HH:mm:ss";
    public static final String DATE_TIME_STR = "yyyyMMddHHmmss";
    public static final String DATE_STR = "yyyyMMdd";
    public static final String TIME_STR = "HHmmss";

    public static String getDateTime() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATE_TIME));
    }

    public static String getDate() {
        return LocalDate.now().format(DateTimeFormatter.ofPattern(DATE));
    }

    public static String getTime() {
        return LocalTime.now().format(DateTimeFormatter.ofPattern(TIME));
    }

    public static String getDateTimeStr() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATE_TIME_STR));
    }

    public static String getDateStr() {
        return LocalDate.now().format(DateTimeFormatter.ofPattern(DATE_STR));
    }

    public static String getTimeStr() {
        return LocalTime.now().format(DateTimeFormatter.ofPattern(TIME_STR));
    }

}
